import http from '@/utils/http'
export default {
  // 注册
  async register(data) {
    return await http.post('/api/register', data)
  },
  //   登录
  async login(data) {
    return await http.post('/api/login', data)
  },
  //   获取验证码
  async getAuthCode() {
    return await http.get('/api/captchaImage')
  },
  // 获取用户信息
  async getUserInfo() {
    return await http.get('/api/user/selectOne')
  },

  // 根据用户名查用户
  async getUserByUsername(username) {
    return await http.post('/api/user/selectOne/' + username)
  },
  // 关注用户
  async focusUser(username) {
    return await http.post('/api/user/friend/add/' + username)
  },
  // 获取关注列表
  async getFocusList() {
    return await http.get('/api/user/friend/list')
  },
  // 修改个人信息
  async changeUserInfo(data) {
    return await http.post('/api/user/updateOne', data)
  },
  // 修改密码
  async changePassword(password) {
    return await http.post('/api/user/resetPassword/' + password)
  }
}
